home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_05
/
9n05071a
< prev
next >
Wrap
Text File
|
1991-03-02
|
412b
|
27 lines
/* CUJ example, Stephen D. Williams, SDW Systems */
#include <stdio.h>
main()
{
char *ptr = "hi there george";
puts(ptr);
/* ((long *)&ptr)++; <---incorrect */
(*((long**)&ptr))++;
puts(ptr);
#define ptr_type(type, prt) (*((type**)&ptr))
puts((char *)++(ptr_type(long,ptr)));
#undef ptr_type /* scoped macro*/
}
/*
output:
hi there george
here george
george
*/